<template>
  <div class="w">
    <img :src="detail.product_picture" alt="" />
    <p>{{ detail.product_name }}</p>
    <p>{{ detail.product_intro }}</p>
    <p>{{ detail.product_selling_price }}</p>
    <el-button plain @click="add(detail)"> 加入购物车 </el-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      detail: this.$route.query.obj,
    };
  },
  mounted() {
    this.add();
  },
  methods: {
    add(detail) {
      this.$store.commit("add", detail);
      this.$notify({
        title: "加入成功",
        type: "success",
      });
    },
  },
};
</script>

<style lang='scss' scoped>
p {
  font-size: 20px;
}
.btn {
  font-size: 16px;
}
</style>
